$OpenBSD: patch-configure,v 1.6 2013/11/03 07:52:01 ajacoutot Exp $
--- configure.orig	Thu Mar 15 07:44:01 2001
+++ configure	Sun Oct 21 01:39:52 2007
@@ -4385,6 +4385,13 @@ else
 fi
 
 fi
+
+if test "x`uname -s`" = "xOpenBSD" -a "x$enable_shared" = "xyes"; then
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    G_MODULE_LDFLAGS="-Wl,-E"
+  fi
+fi
+
 if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
 	case "$host_os" in
 	  linux*)
@@ -5183,6 +5190,13 @@ G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_REENTRANT" # good
 		# FreeBSD 2.2.x shiped with gcc 2.7.2.x, which doesn't support
 		# -mthreads flag.
 		;;
+	*-openbsd*)
+		G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_THREAD_SAFE"
+		  if test "x$G_THREAD_LIBS" = "x-lc_r" -o \
+			"x$G_THREAD_LIBS" = "x-lpthread" ; then
+		    G_THREAD_LIBS="-lpthread"
+		  fi
+		;;
     esac
 
     # if we are not finding the ctime_r function, then we probably are
@@ -5468,8 +5482,6 @@ EOF
 
 
 
-
-CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
 
 
         case "$mutex_has_default" in
